//                https://ac.nowcoder.com/acm/problem/26229



#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

const int maxn = 200004;
int a[maxn];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

	int ans = 1;
	int len = 1;
	for (int i = 1; i < n; i++)
	{
		if (a[i] - a[i - 1] <= 8)
			len++;
		else
			len = 1;
		res = max(len, ans);
	}
	cout << ans << endl;
	return 0;
}